Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

f(x, y, w, w, a) → g1(x, x, y, w)
f(x, y, w, a, a) → g1(y, x, x, w)
f(x, y, a, a, w) → g2(x, y, y, w)
f(x, y, a, w, w) → g2(y, y, x, w)
g1(x, x, y, a) → h(x, y)
g1(y, x, x, a) → h(x, y)
g2(x, y, y, a) → h(x, y)
g2(y, y, x, a) → h(x, y)
h(x, x) → x

Q is empty.


QTRS
  ↳ DirectTerminationProof

Q restricted rewrite system:
The TRS R consists of the following rules:

f(x, y, w, w, a) → g1(x, x, y, w)
f(x, y, w, a, a) → g1(y, x, x, w)
f(x, y, a, a, w) → g2(x, y, y, w)
f(x, y, a, w, w) → g2(y, y, x, w)
g1(x, x, y, a) → h(x, y)
g1(y, x, x, a) → h(x, y)
g2(x, y, y, a) → h(x, y)
g2(y, y, x, a) → h(x, y)
h(x, x) → x

Q is empty.

We use [23] with the following order to prove termination.

Recursive path order with status [2].
Precedence:
f5 > g14 > h2
f5 > g24 > h2

Status:
trivial